import { defineComponent, onUnmounted, reactive } from 'vue'
import Draw from './educationDraw'

export default defineComponent({
  components: {
    Draw,
  },
  setup() {
    let intervalInstance = null
    const cdata = reactive({
      list:[
        {
            name: '政治教育',
            max: 90,
        },
        {
            name: '思想教育',
            max: 90,
        },
        {
            name: '道德教育',
            max: 90,
        },
        {
            name: '法律教育',
            max: 90,
        },
        {
            name: '心理教育',
            max: 90,
        }
      ],
      data1:[[80, 50, 55, 80, 50]],
      data2:[[60, 60, 65, 60, 70]],
      index :0
    })
    intervalInstance = setInterval(() => {
      cdata.index += 1
    }, 2000)

    onUnmounted(() => {
      clearInterval(intervalInstance)
    })
    return () => {
      return (
        <div>
          <Draw cdata={cdata} />
        </div>
      )
    }
  },
})
